unit CagriTanimlamalari;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, FormClass, ComCtrls, XPMan, StdActns, ActnList, cxStyles,
  cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB,
  cxDBData, cxGridLevel, cxClasses, cxControls, cxGridCustomView,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid, ADODB,
  cxCheckBox, cxDBLookupComboBox, cxCalendar, siComp;

type
  TfmCagriTanimlamalari = class(TfmFormClass)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    TabSheet3: TTabSheet;
    TabSheet4: TTabSheet;
    Grid1: TcxGrid;
    Grid1DBTableView1: TcxGridDBTableView;
    Grid1Level1: TcxGridLevel;
    aqGelisSekil: TADOQuery;
    dsGelisSekil: TDataSource;
    dsAramaNeden: TDataSource;
    aqAramaNeden: TADOQuery;
    dsCagriDurum: TDataSource;
    aqCagriDurum: TADOQuery;
    dsYapilanislem: TDataSource;
    aqYapilanislem: TADOQuery;
    Grid1DBTableView1isim: TcxGridDBColumn;
    Grid1DBTableView1Sira: TcxGridDBColumn;
    Grid1DBTableView1cDefault: TcxGridDBColumn;
    cxGrid1: TcxGrid;
    cxGridDBTableView1: TcxGridDBTableView;
    cxGridDBColumn1: TcxGridDBColumn;
    cxGridDBColumn2: TcxGridDBColumn;
    cxGridDBColumn3: TcxGridDBColumn;
    cxGridLevel1: TcxGridLevel;
    cxGrid2: TcxGrid;
    cxGridDBTableView2: TcxGridDBTableView;
    cxGridDBColumn4: TcxGridDBColumn;
    cxGridDBColumn5: TcxGridDBColumn;
    cxGridDBColumn6: TcxGridDBColumn;
    cxGridLevel2: TcxGridLevel;
    cxGrid3: TcxGrid;
    cxGridDBTableView3: TcxGridDBTableView;
    cxGridDBColumn7: TcxGridDBColumn;
    cxGridDBColumn8: TcxGridDBColumn;
    cxGridDBColumn9: TcxGridDBColumn;
    cxGridLevel3: TcxGridLevel;
    TabSheet5: TTabSheet;
    aqNedenNedenDetay: TADOQuery;
    dsNedenNedenDetay: TDataSource;
    cxGrid5: TcxGrid;
    cxGridDBTableView5: TcxGridDBTableView;
    cxGridDBColumn12: TcxGridDBColumn;
    cxGridLevel5: TcxGridLevel;
    aqAramaNedenDetay: TADOQuery;
    dsAramaNedenDetay: TDataSource;
    TabSheet6: TTabSheet;
    cxGrid6: TcxGrid;
    cxGridDBTableView6: TcxGridDBTableView;
    cxGridDBColumn10: TcxGridDBColumn;
    cxGridDBColumn13: TcxGridDBColumn;
    cxGridDBColumn14: TcxGridDBColumn;
    cxGridLevel6: TcxGridLevel;
    cxGrid7: TcxGrid;
    cxGridDBTableView7: TcxGridDBTableView;
    cxGridDBColumn15: TcxGridDBColumn;
    cxGridLevel7: TcxGridLevel;
    aqNedenDetayAksiyon: TADOQuery;
    dsNedenDetayAksiyon: TDataSource;
    cxGrid4: TcxGrid;
    cxGridDBTableView4: TcxGridDBTableView;
    cxGridDBColumn11: TcxGridDBColumn;
    cxGridLevel4: TcxGridLevel;
    TabSheet7: TTabSheet;
    cxGrid8: TcxGrid;
    cxGridDBTableView8: TcxGridDBTableView;
    cxGridLevel8: TcxGridLevel;
    aqCagriTepki: TADOQuery;
    dsCagriTepki: TDataSource;
    cxGridDBTableView8isim: TcxGridDBColumn;
    TabSheet8: TTabSheet;
    aqCagriAriza: TADOQuery;
    dsCagriAriza: TDataSource;
    cxGrid9: TcxGrid;
    cxGridDBTableView9: TcxGridDBTableView;
    cxGridDBColumn16: TcxGridDBColumn;
    cxGridLevel9: TcxGridLevel;
    TabSheet9: TTabSheet;
    cxGrid10: TcxGrid;
    cxGridDBTableView10: TcxGridDBTableView;
    cxGridDBColumn17: TcxGridDBColumn;
    cxGridLevel10: TcxGridLevel;
    aqPlatform: TADOQuery;
    dsPlatform: TDataSource;
    cxGridDBTableView10Tarih: TcxGridDBColumn;
    cxGridDBTableView10Adet: TcxGridDBColumn;
    aqKurulum: TADOQuery;
    dsKurulum: TDataSource;
    TabSheet10: TTabSheet;
    cxGrid11: TcxGrid;
    cxGridDBTableView11: TcxGridDBTableView;
    cxGridDBColumn18: TcxGridDBColumn;
    cxGridDBColumn19: TcxGridDBColumn;
    cxGridLevel11: TcxGridLevel;
    TabSheet11: TTabSheet;
    cxGrid12: TcxGrid;
    cxGridDBTableView12: TcxGridDBTableView;
    cxGridDBColumn20: TcxGridDBColumn;
    cxGridLevel12: TcxGridLevel;
    aqCagriSikayetTanim: TADOQuery;
    dsCagriSikayetTanim: TDataSource;
    cxGridDBColumn66: TcxGridDBColumn;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormShow(Sender: TObject);
    procedure aqNedenNedenDetayBeforePost(DataSet: TDataSet);
    procedure aqNedenDetayAksiyonBeforePost(DataSet: TDataSet);
    procedure cxGridDBTableView7FocusedRecordChanged(
      Sender: TcxCustomGridTableView; APrevFocusedRecord,
      AFocusedRecord: TcxCustomGridRecord;
      ANewItemRecordFocusingChanged: Boolean);
    procedure cxGridDBTableView4FocusedRecordChanged(
      Sender: TcxCustomGridTableView; APrevFocusedRecord,
      AFocusedRecord: TcxCustomGridRecord;
      ANewItemRecordFocusingChanged: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmCagriTanimlamalari: TfmCagriTanimlamalari;

implementation
uses data, ana1;
{$R *.dfm}

procedure TfmCagriTanimlamalari.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  inherited;
  Action := caFree;
  fmCagriTanimlamalari := nil;
end;

procedure TfmCagriTanimlamalari.FormShow(Sender: TObject);
begin
  inherited;
  OpenQueryOnDataSet(aqAramaNedenDetay.SQL.Text, aqAramaNedenDetay);
  OpenQueryOnDataSet(aqYapilanislem.SQL.Text, aqYapilanislem);
  OpenQueryOnDataSet(aqAramaNeden.SQL.Text, aqAramaNeden);
  OpenQueryOnDataSet(aqGelisSekil.SQL.Text, aqGelisSekil);
  OpenQueryOnDataSet(aqCagriDurum.SQL.Text, aqCagriDurum);
  OpenQueryOnDataSet(aqCagriTepki.SQL.Text, aqCagriTepki);
  OpenQueryOnDataSet(aqCagriAriza.SQL.Text, aqCagriAriza);
  OpenQueryOnDataSet(aqPlatform.SQL.Text, aqPlatform);
  OpenQueryOnDataSet(aqKurulum.SQL.Text, aqKurulum);
  OpenQueryOnDataSet(aqCagriSikayetTanim.SQL.Text, aqCagriSikayetTanim);
end;

procedure TfmCagriTanimlamalari.aqNedenNedenDetayBeforePost(
  DataSet: TDataSet);
begin
  inherited;
  Dataset.FieldByName('Nedenid').Value := aqAramaNeden.FieldByName('Ref').Value;
end;

procedure TfmCagriTanimlamalari.aqNedenDetayAksiyonBeforePost(
  DataSet: TDataSet);
begin
  inherited;
  Dataset.FieldByName('NedenNedenDetayRef').Value := aqNedenNedenDetay.FieldByName('Ref').Value;
end;

procedure TfmCagriTanimlamalari.cxGridDBTableView7FocusedRecordChanged(
  Sender: TcxCustomGridTableView; APrevFocusedRecord,
  AFocusedRecord: TcxCustomGridRecord;
  ANewItemRecordFocusingChanged: Boolean);
begin
  inherited;
  OpenQueryOnDataSet('select * from TblCagriNedenNedenDetay Where Nedenid=' + inttostr(aqAramaNeden.FieldByName('Ref').AsInteger) + ' Order By (select Sira from TblCagriNedenDetay Where Ref=NedenDetayid)', aqNedenNedenDetay);
end;

procedure TfmCagriTanimlamalari.cxGridDBTableView4FocusedRecordChanged(
  Sender: TcxCustomGridTableView; APrevFocusedRecord,
  AFocusedRecord: TcxCustomGridRecord;
  ANewItemRecordFocusingChanged: Boolean);
begin
  inherited;
  OpenQueryOnDataSet('select * from TblCagriNedenDetayAksiyon Where NedenNedenDetayRef=' + inttostr(aqNedenNedenDetay.FieldByName('Ref').AsInteger) + ' Order By (select Sira from TblCagriAksiyon Where Ref=Aksiyonid)', aqNedenDetayAksiyon);
end;

end.
